﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LogisticsDAL;
using LogisticsModel;

namespace LogisticsBLL
{
    public class TruckBLL
    {
        #region 车辆列表
        /// <summary>
        /// 车辆列表
        /// </summary>
        /// <returns></returns>
        public static List<Truck> GetTruckList(int teamId, string number, string type, int state) => LogisticsDAL.TruckDAL.GetTruckList(teamId, number, type, state);
        #endregion

        #region 车辆详情
        /// <summary>
        /// 车辆详情
        /// </summary>
        /// <returns></returns>
        public static Truck GetTruck(string tid) => LogisticsDAL.TruckDAL.GetTruck(tid);
        #endregion

        #region 添加车辆
        public static bool AddTruck(Truck truck)
        {

            return LogisticsDAL.TruckDAL.AddTruck(truck) > 0;
        }
        #endregion

        #region 删除车辆
        /// <summary>
        /// 删除车辆
        /// </summary>
        /// <param name="tid">通过车辆编号删除</param>
        /// <returns>int类型</returns>
        public static bool DeleteTruck(int tid) => LogisticsDAL.TruckDAL.DeleteTruck(tid) > 0;
        #endregion

        #region 修改车辆
        /// <summary>
        /// 修改车辆
        /// </summary>
        /// <param name="truck">通过传递一个Truck对象类来传递数据</param>
        /// <returns>int类型</returns>
        public static bool EditTruck(Truck truck) => LogisticsDAL.TruckDAL.EditTruck(truck) > 0;
        #endregion

        #region 所属车队下拉框
        /// <summary>
        /// 通过查询TeamTruck里面的车队编号和车队名称来绑定下拉框
        /// </summary>
        /// <returns></returns>
        public static List<TruckTeam> GetTruckName() => LogisticsDAL.TruckDAL.GetTruckName();
        #endregion

        #region 车辆类型下拉框
        /// <summary>
        /// 车辆类型下拉框
        /// </summary>
        /// <returns></returns>
        public static List<Truck> GetTruckType() => LogisticsDAL.TruckDAL.GetTruckType();
        #endregion

        #region 统计数据总条数
        /// <summary>
        /// 统计总条数
        /// </summary>
        /// <returns>int类型</returns>
        public static int GetTruckCount() => LogisticsDAL.TruckDAL.GetTruckCount();
        #endregion
    }
}
